package Dao;

import Model.Student;
import Model.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface StudentDao {
    @Select("select * from stuhhh")
    List<Student> findAll();
    @Select("select * from stuhhh")
    List<Student> findAll1(String sql);

    @Insert("insert into stuhhh values(null,#{name},#{sex},#{age},#{major},#{time})")
    int saveStudent(Student stu);
    @Delete("delete from stuhhh where id=#{id}")
    int deleteStudent(int id);
    @Update("update stuhhh set name=#{name},sex=#{sex},age=#{age},major=#{major},time=#{time}where id=#{id}")
    int updateStudent(Student student);
    //根据id查询一条数据
    @Select("select * from stuhhh where id =#{id}")
    Student findById(Integer id);
    //模糊查询
    @Select("select * from stuhhh where name like '%${value}%'")
    List<Student> findByName(String name);
    //查询总数量
    @Select("select count(*) from stuhhh")
    int findTotal();
    @Select("select * from guan where username=#{username} and password=#{password}")
    User login(@Param("username") String username, @Param("password") String password);
}
